package me.yushuai.wukong.base.entity;

import lombok.*;
import me.yushuai.wukong.common.domain.AbstractAudit;
import org.hibernate.Hibernate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 库位组
 *
 * @author zhoushuai@189.cn
 * @TableName BAS_LOC_GROUP2
 */
@Getter
@Setter
@Entity
@ToString
@RequiredArgsConstructor
@Table(name = "BAS_LOC_GROUP")
public class LocGroup extends AbstractAudit implements Serializable {

    public static final String GROUP_ID = "groupId";

    public static final String BIZ_ID = "biz_id";

    /**
     * 库位组编号
     */
    @Id
    @Column(name = "GROUP_ID")
    private Long groupId;

    /**
     * 库位组编码
     */
    @Column(name = "GROUP_BIZ_ID", updatable = false)
    private String bizId;

    /**
     * 中文描述
     */
    @Column(name = "DESC_CH")
    private String descCh;

    /**
     * 仓库ID
     */
    @Column(name = "WAREHOUSE_ID", updatable = false)
    private Long warehouseId;

    /**
     * 备注说明
     */
    @Column(name = "NOTES")
    private String notes;

    /**
     * 自定义01
     */
    @Column(name = "UDF01")
    private String udf01;

    /**
     * 自定义02
     */
    @Column(name = "UDF02")
    private String udf02;

    /**
     * 自定义03
     */
    @Column(name = "UDF03")
    private String udf03;

    /**
     * 自定义04
     */
    @Column(name = "UDF04")
    private String udf04;

    /**
     * 自定义05
     */
    @Column(name = "UDF05")
    private String udf05;

    /**
     * 自定义06
     */
    @Column(name = "UDF06")
    private String udf06;

    /**
     * 自定义07
     */
    @Column(name = "UDF07")
    private String udf07;

    /**
     * 自定义08
     */
    @Column(name = "UDF08")
    private String udf08;

    /**
     * 当前版本号
     */
    @Version
    @Column(name = "CUR_VER_NO")
    private Long curVerNo;

    /**
     * 操作流水号标记
     */
    @Column(name = "OPR_SEQ_FG")
    private String oprSeqFg;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
            return false;
        }
        LocGroup locGroup = (LocGroup) o;
        return groupId != null && Objects.equals(groupId, locGroup.groupId);
    }

    @Override
    public int hashCode() {
        return getClass().hashCode();
    }
}